<?php
/**
 * Image.php
 * 
 * @category   Naneau
 * @package    Naneau_Image
 * @copyright  Copyright (c) 2007 Maurice Fonk - http://naneau.nl
 * @version    0.1
 */

/**
 * Naneau_Image
 * 
 * a very basic class for image manipulation
 *
 * @category   Naneau
 * @package    Naneau_Image
 * @copyright  Copyright (c) 2007 Maurice Fonk - http://naneau.nl
 */
class Naneau_Image {
    /**
     * jpeg
     * @var int
     */
    const TYPE_JPEG = 0;

    /**
     * gif
     * @var int
     */
    const TYPE_GIF = 1;

    /**
     * png
     * @var png
     */
    const TYPE_PNG = 2;


    /**
     * constructor
     *
     * @param string $fileName
     * @param int $adapter
     * @param string $mimeType
     * @return Naneau_Image_Adapter_Abstract
     */
    public static function factory($fileName, $adapterType = 'gd', $mimeType) {
        if ($adapterType == 'gd') {
            require_once 'Naneau/Image/Adapter/Gd.php';
            $adapter = new Naneau_Image_Adapter_Gd($fileName, $mimeType);
        }
        elseif ($adapterType == 'imagick') {
            require_once 'Naneau/Image/Adapter/Imagick.php';
            $adapter = new Naneau_Image_Adapter_Imagick($fileName, $mimeType);
        }
        else {
            throw new Exception('Invalid adapter specified');
        }
        return $adapter;
    }


}